package com.ruoyi.iot.controller;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.iot.service.IStatisticDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName StatisticDateController
 * @Description 统计业务
 * @Author hly
 * @Date 2024/1/17 14:51
 */
@RestController
@RequestMapping(value = "/statistic")
public class StatisticDataController extends BaseController {


    @Autowired
    private IStatisticDataService statisticDataService;

    @RequestMapping(value = "/agentDicts")
    public AjaxResult agentDicts() {
        LoginUser user = getLoginUser();
        return AjaxResult.success(statisticDataService.agentDicts(user));
    }

    @RequestMapping(value = "/channleDicts")
    public AjaxResult channleDicts() {
        return AjaxResult.success(statisticDataService.channleDicts());
    }

    @RequestMapping(value = "/getDict")
    public AjaxResult getDict(@RequestParam(value = "code") String code) {
        return AjaxResult.success(statisticDataService.getDict(code));
    }

    @RequestMapping(value = "/packageGroupDicts")
    public AjaxResult getPackageGroup() {
        return AjaxResult.success(statisticDataService.packageGroupDict());
    }
}
